#!/usr/bin/env bash
# 实例文件：hard_to_kill

function trapped {
    if [ "$1" = "USR1" ]; then
        echo "Got me with a $1 trap!"
        exit
    else
        echo "$eceived $1 trap--neener, neener"
    fi
}

trap "trapped ABRT" ABRT
trap "trapped EXIT" EXIT
trap "trapped HUP" HUP
trap "trapped INT" INT
trap "trapped KILL" KILL
trap "trapped QUIT" QUIT
trap "trapped TERM" TERM
trap "trapper USR1" USR1

# 空循环，什么都不做
# 效果和sleep一样

while ((1)); do
    :
done
sleep 120
